﻿

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CP2011_Assignment
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            //validate id and password
            if (txtUsername.Text == "1234" && txtPassword.Text == "1234")
            {
                this.refresh();
                this.Hide();
                MenuProductionUI menu = new MenuProductionUI();
                menu.Show();
                menu.Owner = this;
            }
            else if (txtUsername.Text == "123" && txtPassword.Text == "1234")
            {
                this.refresh();
                this.Hide();
                MenuInventoryUI menu = new MenuInventoryUI();
                menu.Show();
                menu.Owner = this;
            }
        }

        private void refresh()
        {
            txtUsername.Focus();
            txtUsername.Text = "";
            txtPassword.Text = "";
        }

        private void Login_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.Hide();
            Application.Exit();
        }
         private void Login_Load(object sender, EventArgs e)
        {

        }

    }
}

